
  import { mapGetters } from 'vuex'
export default {
  computed: {
    ...mapGetters('cart', ['total'])
  },
  // 消除左滑删除商品后购物车info不能立即更新的bug
  watch: {
    total(newv) {
      this.setInfo(newv)
    }
  },
  onShow () {
    this.setInfo(this.total)
  },
  methods: {
    setInfo (num) {
      uni.setTabBarBadge({
        index: 2,
        text: num + ''
      })
    }
  }
}